This repository was archived by the owner on Nov 28, 2025. It is now read-only.
Allow deserializing string-only text component#8
Merged
LukynkaCZE merged 3 commits intoDockyardMC:masterfrom Oct 28, 2025
Merged
Allow deserializing string-only text component#8LukynkaCZE merged 3 commits intoDockyardMC:masterfrom
LukynkaCZE merged 3 commits intoDockyardMC:masterfrom
Conversation
Use the module JRE rather than a specifically-named JRE.
This ensures that any way the Component class is deserialized will also work, instead of only through JsonToComponentSerializer.
LukynkaCZE
approved these changes
Oct 28, 2025
Contributor
|
There you go, modtoberfest should accept it automatically without any extra labels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #1 by implementing a custom deserializer for
Componentin the form ofJsonTransformingSerializer, which transforms string-only components with their equivalent object-form component and otherwise delegates to the plugin-generated serializer. A test is added to check the behavior.This also adjusts the "Run Tests" run configuration slightly to remove a reference to a named JRE, so the run configuration works with the module JRE.
The second part of that issue regarding a crash for the
extrasfield in JSON deserialization seems to not be applicable, perhaps due to the rewrite made in the commit immediately after the one the linked issue mentions.Side-notes:
Component(text = "test") == Component(text = "test")evaluates tofalse. I'm not knowledgeable enough in Kotlin to understand why that happens though.LICENSEfile or otherwise at the root of the repository.(P.S. Could I please ask you to add the
hacktoberfesttopic to your repository, or label this with ahacktoberfest-acceptedlabel? Thank you!)